<template>
  <div class="login">
    <div class="div">
      <el-input v-model="userName" placeholder="请输入用户名"></el-input>
    </div>
    <div class="div">
      <el-input v-model="password" placeholder="请输入密码" type="password"></el-input>
    </div>
    <div class="div">
      <el-button plain class="button" v-on:click="login">提交</el-button>
    </div>
  </div>
</template>

<script>
  import axios from 'axios';
  export default {
    name: 'Login',
    data() {
      return {
        userName: '',
        password:''
      }
    },
    methods:{
      login:function (event) {
        axios.post("http://192.168.101.155:8099/login",{
          userName:this.userName,
          password:this.password
        }).then((response)=>{
            console.log(response);
            this.$router.push({path:'/hello'});
          }).catch(function () {
            console.log(1);
        });
      }
    }
  }

</script>
<style>
  .login{
    width: 20%;
    margin-left: 40%;
    margin-top: 15%;
    min-width: 200px;
  }
  .button{
    width: 100%;
  }

  .div{
    margin-bottom: 10%;
  }

</style>
